package com.sdruixinggroup.mondayb2b.utils;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * Created by tangjie on 2017/11/11.
 */

public class UserDate {
    public static  void setUserName(Context context,String username){
        SharedPreferences preferences = context.getSharedPreferences("user", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putString("username", username);
        editor.commit();
    }

    public static String getUserName(Context context) {
        SharedPreferences preferences = context.getSharedPreferences("user",
                Context.MODE_PRIVATE);
        String  username = preferences.getString("username", "");
        return username;
    }

    public static  void setName(Context context,String name){
        SharedPreferences preferences = context.getSharedPreferences("user", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putString("name", name);
        editor.commit();
    }

    public static String getName(Context context) {
        SharedPreferences preferences = context.getSharedPreferences("user",
                Context.MODE_PRIVATE);
        String  username = preferences.getString("name", "");
        return username;
    }

    public static  void setAreaName(Context context,String Areaname){
        SharedPreferences preferences = context.getSharedPreferences("user", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putString("Areaname", Areaname);
        editor.commit();
    }

    public static String getAreaName(Context context) {
        SharedPreferences preferences = context.getSharedPreferences("user",
                Context.MODE_PRIVATE);
        String  username = preferences.getString("Areaname", "");
        return username;
    }

    public static  void setAreaID(Context context,int  AreaID){
        SharedPreferences preferences = context.getSharedPreferences("user", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = preferences.edit();
        editor.putInt("AreaID", AreaID);
        editor.commit();
    }

    public static int getAreaID(Context context) {
        SharedPreferences preferences = context.getSharedPreferences("user",
                Context.MODE_PRIVATE);
        int  username = preferences.getInt("AreaID", 0);
        return username;
    }
}
